package com.ailink.spring.event;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

@Component
public class MyApplicationEventListener implements ApplicationListener<MyApplicationEvent> {

    @Override
    public void onApplicationEvent(MyApplicationEvent event) {
        System.out.println(event.toString());
    }

    @EventListener(ContextRefreshedEvent.class)
    public void onApplicationEventContextRefreshedEvent(ContextRefreshedEvent event) {
        System.out.println("onApplicationEventContextRefreshedEvent");
    }
}
